#ifndef __PLANE_HPP__
#define __PLANE_HPP__

#include "Vector3.hpp"

namespace PocketSurvival::Engine
{
    struct Plane
    {
        Vector3 Normal;
        float D;

        constexpr Plane(const Vector3 &normal, float d) noexcept;
        Plane(const Vector3 &a, const Vector3 &b, const Vector3 &c);
        constexpr Plane(float x, float y, float z, float d) noexcept;
    };

        constexpr inline Plane::Plane(const Vector3 &normal, float d) noexcept : Normal(normal),D(d){}

        inline Plane::Plane(const Vector3 &a, const Vector3 &b, const Vector3 &c) : Normal(Vector3::Normalize(Vector3::Cross(b - a, c - a))), D(0.0f - Vector3::Dot(Normal, a)){}

        constexpr inline Plane::Plane(float x, float y, float z, float d) noexcept : Normal(x, y, z), D(d){}

} // namespace PocketSurvival::Engine

#endif
